package cz.patamat.support;

import java.util.ArrayList;
import java.util.List;


public class Question {
	
	private final String id;
	
	private final String text; 
	
	private List<Answer> answers = new ArrayList<Answer>();
	
	private List<Answer> markedAnswers = new ArrayList<Answer>();
	
	public Question(String id, String text) {
		this.id = id;
		this.text = text;
	}
	
	public String getId() {
		return id;
	}
	
	public String getText() {
		return text;
	}
	
	/**
	 * 
	 * @param answerId
	 * @return null if answer with given id does not belong between answers to this question.
	 */
	public Answer getAnswerById(String answerId) {
		for (Answer answer: answers) {
			if (answer.getId().equals(answerId)) {
				return answer;
			}
		}
		return null;
	}
	
	public List<Answer> getAnswers() {
		return answers;
	}
	
	public void addAnswer(Answer answer) {
		answers.add(answer);
	}

	public void markAnswer(Answer answer) {		
		markedAnswers.add(answer);
	}

	public List<Answer> getMarkedAnswers() {
		return markedAnswers;
	}
	
}